package com.xmb.wechat.view.qq;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Typeface;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.xmb.wechat.R;
import com.xmb.wechat.R2;
import com.xmb.wechat.base.BaseActivity;
import com.xmb.wechat.util.PicLoadUtils;
import com.xmb.wechat.widget.MoveConstraintLayout;

import butterknife.BindView;

/**
 * @Author lijiangop
 * @CreateTime 2020/5/21 09:33
 */
public class QQAccountDetailActivity extends BaseActivity {

    @BindView(R2.id.iv_bg)
    ImageView            mIvBg;
    @BindView(R2.id.tv_money)
    TextView             mTvMoney;
    @BindView(R2.id.tv_qbi)
    TextView             mTvQbi;
    @BindView(R2.id.v_hint)
    View                 mVHint;
    @BindView(R2.id.tv_hint)
    TextView             mTvHint;
    @BindView(R2.id.mc)
    MoveConstraintLayout mMc;

    public QQAccountDetailActivity() {
        super(R.layout.activity_qq_account_detail);
    }

    public static void start(Activity activity, String screenShot, String balance, String q_bi) {
        Intent intent = new Intent(activity, QQAccountDetailActivity.class);
        intent.putExtra("screenShot", screenShot);
        intent.putExtra("balance", balance);
        intent.putExtra("q_bi", q_bi);
        activity.startActivity(intent);
    }

    @Override
    protected void initView() {
        setStatusBarColor(Color.parseColor("#f4f7f9"));
        String screenShot = getIntent().getStringExtra("screenShot");
        String balance = getIntent().getStringExtra("balance");
        String q_bi = getIntent().getStringExtra("q_bi");
        //show view
        if (!TextUtils.isEmpty(screenShot))
            PicLoadUtils.loadSdcardPic(screenShot, mIvBg);
        if (!TextUtils.isEmpty(balance))
            mTvMoney.setText(balance);
        if (!TextUtils.isEmpty(q_bi))
            mTvQbi.setText(q_bi);
        //change font
        Typeface fromAsset = Typeface.createFromAsset(getAssets(), "fonts/alipay_number.ttf");
        if (fromAsset != null)
            mTvMoney.setTypeface(fromAsset);
        if (fromAsset != null)
            mTvQbi.setTypeface(fromAsset);

        mMc.setOnClickListener(new MoveConstraintLayout.onClickListener() {
            @Override
            public void onClick() {
                mVHint.setVisibility(View.GONE);
                mTvHint.setVisibility(View.GONE);
            }
        });
        mVHint.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mVHint.setVisibility(View.GONE);
                mTvHint.setVisibility(View.GONE);
            }
        });
        mTvHint.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mVHint.setVisibility(View.GONE);
                mTvHint.setVisibility(View.GONE);
            }
        });
    }
}
